<template>
   <el-dialog title="添加分类信息" :visible.sync="dialogCate.show">
   <el-form :model="formData" :rules="rules" ref="ruleForm" label-width="100px" >
        <el-form-item label="活动名称" prop="c_name">
            <el-input v-model="formData.c_name"></el-input>
        </el-form-item>
    </el-form>
  <div slot="footer" class="dialog-footer">
    <el-button @click="dialogCate.show = false">取 消</el-button>
    <el-button type="primary" @click="dialogCateAdd('ruleForm')">确 定</el-button>
  </div>
</el-dialog>
</template>

<script>
export default {
    props:{
            dialogCate:Object
   },
data(){
    return{
        

        formData: {
          c_name: ''
        },
        rules:{
                c_name: [{ required: true, message: "日期不能为空", trigger: "blur" }],        
        }

    }
},
methods:{
    dialogCateAdd(formname){
        this.$refs[formname].validate((valid)=>{
            if(valid){
                this.$axios.post('/cate/add',this.formData).then(res=>{
                    this.$message({
                            type:"success",
                            message:"添加信息成功"
                    })

                    this.dialogCate.show=false;
                    this.$emit("update")
                })
                this.formData={};
            }else{
                console.log("error submit ")
                return false
            }
        })
    }
}
}
</script>

<style>

</style>